/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.time.LocalDate;
import java.util.Date;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

/**
 * <p>Project: jse2302 - UserDemo
 * <p>Powered by webrx On 2023-06-28 14:08:10
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class UserDemo {
    public static void main(String[] args) throws Exception{
        //User u = new User();
        //u.setId(10);
        //u.setName("张三丰");
        //u.setAddress("河南省郑州市科学大道");
        //u.setBirth(new Date());



        //把u保存到文件中。
        //var os = new FileOutputStream("user.dat");
        //var oos = new ObjectOutputStream(os);
        //oos.writeObject(u);
        //oos.close();


        //读取u对象
        var is = new FileInputStream("user.dat");
        var ois = new ObjectInputStream(is);
        User uu = (User)ois.readObject();
        System.out.println(uu.getId());
        System.out.println(uu.getName());
        System.out.println(uu.getAddress());
        System.out.printf("%tF %<tT%n",uu.getBirth());




    }
}
